import { create } from 'zustand';
import { persist } from "zustand/middleware";
interface ThemeStore {
    brandColor: string;
    theme: ThemeType;
    collapsed: boolean;
    setCollasped?: (collasped: boolean) => void,
    setBrandColor?: (brandColor: string) => void,
    setTheme?: (theme: ThemeType) => void
    getTheme?: () => ThemeType,
    getCollasped?: () => boolean,
    getBrandColor?: () => string;
}

const store = persist<ThemeStore>((set, get) => ({
    theme: 'light',
    brandColor: '#417ff9',
    collapsed: true,
    setBrandColor: (brandColor = '#417ff9') => {
        set(() => ({
            brandColor
        }))
    },
    setCollasped: (collapsed) => {
        set(() => ({
            collapsed
        }))
    },
    setTheme: (theme = 'light') => {
        set(() => ({
            theme
        }))
    },
}), { name: 'theme' });

const useThemeStore = create(store);

export default useThemeStore;